package com.jereh.topnews.demo;

import android.os.Bundle;
import android.widget.TextView;

import com.jereh.topnews.R;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivity;

public class SlidingMenuActivity extends SlidingActivity {

    private SlidingMenu menu;
    private TextView sliding;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sliding_menu);
        //设置抽屉的面板
        setBehindContentView(R.layout.sliding_menu_panel);
        //获取面板
        menu=getSlidingMenu();
        //设置抽屉的宽度
        menu.setBehindOffsetRes(R.dimen.slidingbehind);
        //阴影效果的背景
        menu.setShadowDrawable(R.drawable.shadow_color);
        //设置抽屉打开时的淡入淡出的动画效果
        menu.setFadeDegree(0.3f);
        //设置抽屉滑动的区域
        menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        //阴影区域的宽度
        menu.setShadowWidthRes(R.dimen.shadow_width);
        //设置第二个显示的抽屉面板
        menu.setSecondaryMenu(R.layout.sliding_menu_right_panel);
        //设置抽屉的显示方向
        menu.setMode(SlidingMenu.LEFT_RIGHT);
        //获取面板里边的控件
        sliding=(TextView)menu.findViewById(R.id.sliding);
        //动态修改控件的内容
        sliding.setText("修改完毕后的内容");
    }
}
